/**
 * file: matmult_outer.c
 * author: jack chua
 * desc: parallel implementation of naive matrix multiplication
 *       single outer parallel for
 *
 */

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "matmult.h"

void matmult(const int N, const double *A, const double *B, double *C) {
    int i,j,k;
#pragma omp parallel for shared(N,A,B,C) private(i,j,k)
    for (i=0; i<N; i++) {
        for (j=0; j<N; j++) {
            for (k=0; k<N; k++) {
                C[j*N+i] += A[k*N+i]*B[j*N+k];
            }
        }
    }
}
